package com.qf.web.exhandler;

import com.qf.entity.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public Result ex(Exception e){
        //收集异常日志，发送邮件给开发人员
        return Result.error("服务器忙，请稍后重试~");
    }

    @ExceptionHandler(BussinessException.class)
    public Result bussinessEx(BussinessException e){
        //收集异常日志，发送邮件给开发人员
        return Result.error(e.getMessage());
    }
}
